package org.moonlight.jvm.instructions.comparisons.ifcond;

import org.moonlight.jvm.instructions.base.BranchInstruction;
import org.moonlight.jvm.rtda.exclusive.Frame;

/**
 * IFLE: ifle指令 把 操作数栈栈顶的 int变量 弹出，然后和 0 进行比较，满足条件则跳转
 *       假设 栈顶的 int变量为 X, 那么 IFLE 就是 X <= 0
 *
 * @author Moonlight
 * @createTime 2023/8/22 17:53
 **/
public class IfLe extends BranchInstruction {
    @Override
    public void execute(Frame frame) {
        int val = frame.getOperandStack().popInt();
        if (val <= 0) {
            branch(frame);
        }
    }
}
